// Decompiled by DJ v3.11.11.95 Copyright 2009 Atanas Neshkov  Date: 22/03/2011 12:30:32 p.m.
// Home Page: http://members.fortunecity.com/neshkov/dj.html  http://www.neshkov.com/dj.html - Check often for new version!
// Decompiler options: packimports(3) 
// Source File Name:   DataSourceUtils.java

package com.luxsoft.sw3.impap.services;

import java.sql.SQLException;
import javax.sql.DataSource;
import org.apache.commons.dbcp.BasicDataSource;
import org.apache.log4j.Logger;

public class DataSourceUtils
{

    private DataSourceUtils()
    {
        logger = Logger.getLogger(getClass());
    }

    public DataSource getPapelDataSource()
    {
        if(papelDataSource == null)
        {
            logger.debug("Creando un DataSource a PAPEL: ");
            papelDataSource = new BasicDataSource();
            papelDataSource.setDriverClassName("com.mysql.jdbc.Driver");
            papelDataSource.setUrl("jdbc:mysql://10.10.1.221/produccion");
            papelDataSource.setUsername("root");
            papelDataSource.setPassword("sys");
        }
        return papelDataSource;
    }

    public void close()
        throws SQLException
    {
        if(papelDataSource != null)
            papelDataSource.close();
    }

    public static DataSourceUtils getInstance()
    {
        if(INSTANCE == null)
            INSTANCE = new DataSourceUtils();
        return INSTANCE;
    }

    private Logger logger;
    private static DataSourceUtils INSTANCE;
    private BasicDataSource papelDataSource;
}
